package fr.fort.lycee.spring.daoImpl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import fr.fort.lycee.spring.dao.IDaoEleve;
import fr.fort.lycee.spring.entities.Eleve;
@Repository
@Transactional
public class DaoEleveImpl implements IDaoEleve{

	@PersistenceContext
	private EntityManager em;
	
	public Integer save(Eleve eleve) {
		em.persist(eleve);
		return eleve.getIdCompte();
	}

	public void update(Eleve eleve) {
		em.merge(eleve);
	}

	public void delete(Eleve eleve) {
		em.remove(eleve);
	}

	public Eleve findById(int id) {
		/*Query query= em.createNamedQuery(arg0);
		Eleve retour=(Eleve)getHibernateTemplate().find("from Eleve el "
					+ "left outer join fetch el.classes c "
					+ "left outer join fetch el.inscriptions ins").get(0);
		return retour;*/
		return null;
	}

@Override
	public List<Eleve> findAll() {
		// TODO Auto-generated method stub
		return null;
	}
}
